let model = require('../Model/brandModel');

module.exports = {
    res: undefined,
    addBrand: function (info) {
        model.addBrand(info, function (st) {
            if (st == 400) {
                self.res.json({ code: st, msg: "添加失败" });
            } else {
                self.res.json({ code: st, msg: "添加成功" });
            }
        });
    },
    removeBrand: function (info) {
        model.removeBrand(info, function (st) {
            if (st == 400) {
                self.res.json({ code: st, msg: "删除失败" });
            } else {
                self.res.json({ code: st, msg: "删除成功" });
            }
        });
    },
    updateBrand: function (info) {
        model.updateBrand(info, function (st) {
            if (st == 400) {
                self.res.json({ code: st, msg: "更新失败" });
            } else {
                self.res.json({ code: st, msg: "更新成功" });
            }
        });
    },
    getBrandList: function (info) {
        let self = this;
        model.getBrandList(info, function (st, data) {
            if (st == 400) {
                self.res.json({ code: st, msg: "查询失败" });
            } else {
                self.res.json({ code: st, msg: "查询成功", data: data });
            }
        });
    }
};
